package edu.ubbcs.rs.backend.model;

import edu.ubbcs.rs.backend.model.table.Table;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 * @author Merli Andras-Bertalan
 * @version 1.0
 * @created 09-jan.-2015 15:37:44
 */
@Entity
@javax.persistence.Table(name = "Reservations")
public class Reservation extends BaseEntity {

    private Date date;
    private Integer hour;
    private String message;
    private User reserver;
    private Table table;
    private ReservationEvent reservationEvent;

    public Reservation() {
        this(null, null, null, new User(), null, null);
    }

    public Reservation(Date date, Integer hour, String message, User reserver, Table table, ReservationEvent reservationEvent) {
        this.date = date;
        this.hour = hour;
        this.message = message;
        this.reserver = reserver;
        this.table = table;
        this.reservationEvent = reservationEvent;
    }

    @Column(name = "reservation_date")
    @Temporal(javax.persistence.TemporalType.DATE)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Column(name = "reservation_hour")
    public Integer getHour() {
        return hour;
    }

    public void setHour(Integer hour) {
        this.hour = hour;
    }

    @Column(name = "message")
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @OneToOne
    @JoinColumn(name = "reservation_user")
    public User getReserver() {
        return reserver;
    }

    public void setReserver(User reserver) {
        this.reserver = reserver;
    }

    @OneToOne
    @JoinColumn(name = "reservation_table")
    public Table getTable() {
        return table;
    }

    public void setTable(Table table) {
        this.table = table;
    }

    @Column(name = "reservation_event")
    @Enumerated(EnumType.STRING)
    public ReservationEvent getReservationEvent() {
        return reservationEvent;
    }

    public void setReservationEvent(ReservationEvent reservationEvent) {
        this.reservationEvent = reservationEvent;
    }
}
